import axios from '@/api/axios'
import { Page, ResPage } from '@/types/model'

export function listByUserId (): Promise<ResPage<any>> {
  return axios.get('/ai/aiSession/listByUserId')
}

export function add (params: AddType): Promise<string> {
  return axios.post('/ai/aiSession/add', params)
}


export function pageBySessionId (params: PageBySessionIdType): Promise<ResPage<PageBySessionItemType>> {
  return axios.request({
    url: '/ai/aiSessionHistory/pageBySessionId',
    params,
    method: 'get'
  })
}

export function del(id: string): Promise<void> {
  return axios.post('/ai/aiSession/delete', {id})
}


export type AddType = {
  title: string
}

export type PageBySessionIdType = Page &  {
  sessionId: string
}

export type PageBySessionItemType = {
  id?: string,
  content: string,
  type: number
}
